package com.dr.java.day05;

/**
 * Created by rui on 2017/12/30.
 */
public class ThisDemo1 {
    public static void main(String[] args) {
        Person4 p= new Person4("rui",30);
    }
}

class Person4 {
    private String name;
    private String nation;
    private int age;

    {
        System.out.println("code run");
    }

    public Person4() {
        System.out.println("Person4 run");
    }
// this:可以再构造函数内部，调用其他构造函数
    public Person4(String name) {
        this.name = name;
    }

    public Person4(String name, int age) {
        this(name);
        this.age = age;
    }

    public Person4(String name, String nation, int age) {
        this(name, age);
        this.nation = nation;
    }
}
